﻿using System.Windows.Input;
using YY.Admin.Core;
using YY.Admin.Module;

namespace YY.Admin.ViewModels
{
    /// <summary>
    /// 单个标签的数据模型
    /// </summary>
    public class TabItemModel : BindableBase
    {
        public TabItemModel()
        {
            Id = $"TabRegion_{Guid.NewGuid():N}"; // 保证唯一
        }

        private string? _id;
        public string? Id
        {
            get => _id;
            set => SetProperty(ref _id, value);
        }

        private string? _header;
        public string? Header
        {
            get => _header;
            set => SetProperty(ref _header, value);
        }

        private string? _icon = string.Empty;
        public string? Icon
        {
            get => _icon;
            set => SetProperty(ref _icon, value);
        }

        private IconTypeEnum? _iconType;
        public IconTypeEnum IconType { 
            get {
                return _iconType ?? IconTypeEnum.AntDesign;
            }
            set => SetProperty(ref _iconType, value);
        }

        private string? _viewName = string.Empty;
        public string? ViewName
        {
            get => _viewName;
            set => SetProperty(ref _viewName, value);
        }

        private bool _isSelected;
        public bool IsSelected
        {
            get => _isSelected;
            set => SetProperty(ref _isSelected, value);
        }

        public ICommand? CloseCommand { get; set; }

        // 添加对Tab源的引用
        public TabSource? TabSource { get; set; }
    }

}
